package cn.changein.framework.core.beetl;

import cn.changein.framework.base.auth.context.LoginContext;
import cn.changein.framework.base.constant.ConstantsContext;
import cn.changein.framework.modular.i18n.context.UserTranslationContext;
import cn.changein.framework.util.ToolUtil;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;

/**
 * beetl拓展配置,绑定一些工具类,方便在模板中直接调用
 * 

 * @date: 2020-02-11
 * @copyright: 广州澄境科技有限公司
 */
public class BeetlConfiguration extends BeetlGroupUtilConfiguration {

    private LoginContext loginContext;

    public BeetlConfiguration(LoginContext loginContext) {
        this.loginContext = loginContext;
    }

    @Override
    public void initOther() {
        groupTemplate.registerFunctionPackage("shiro", loginContext);
        groupTemplate.registerFunctionPackage("tool", new ToolUtil());
        groupTemplate.registerFunctionPackage("constants", new ConstantsContext());
        groupTemplate.registerFunctionPackage("lang", new UserTranslationContext());
    }
}
